// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
// 引入echarts
import echarts from 'echarts'

import 'element-ui/lib/theme-chalk/index.css'

import Axios from 'axios'

import store from './store'

Vue.config.productionTip = false

Vue.prototype.$axios = Axios

Vue.use(ElementUI)

Vue.prototype.$echarts = echarts

router.beforeEach((to, from, next) => {
  if (to.meta.requireShiro) {
    if (JSON.parse(localStorage.getItem('teacher')).teacherShiro === 1) {
      next()
    } else {
      next({path: '/empty'})
    }
  } else {
    next()
  }
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
